<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License.  You may obtain a copy of the License at
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied.  See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->

<nz-modal [(nzVisible)]="isVisible" (nzOnCancel)="isVisible = false" nzTitle="Register Model" [nzWidth]="700">
  <form nz-form [formGroup]="registerModelForm" nzLayout="horizontal">
    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>Model Name</nz-form-label>
      <nz-form-control [nzSm]="14" [nzXs]="24">
        <nz-select nzShowSearch name="select-registered-model" formControlName="registeredModelName">
          <nz-option
            *ngFor="let registeredModel of registeredModelList; let i; of: index"
            id="registered-model-name{{ i }}"
            [nzValue]="registeredModel"
            [nzLabel]="registeredModel"
          ></nz-option>
        </nz-select>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24">Tags</nz-form-label>
      <nz-form-control [nzSm]="14">
        <register-model-tags [tags]="tags.value"></register-model-tags>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24">Description</nz-form-label>
      <nz-form-control [nzSm]="14" [nzXs]="24" nzErrorTip="Please write something here!">
        <textarea
          nz-input
          name="description"
          formControlName="description"
          id="description"
          [nzAutosize]="{ minRows: 2, maxRows: 6 }"
        ></textarea>
      </nz-form-control>
    </nz-form-item>
    <div *nzModalFooter>
      <button id="btn-cancel" nz-button nzType="default" (click)="closeModal()">Cancel</button>
      <button id="btn-submit" nz-button nzType="primary" [disabled]="checkStatus()" (click)="submitForm()">
          Create
      </button>
    </div>
  </form>
</nz-modal>